#pragma once

#include <cstdint>
#include <iostream>
#include <cwchar>

namespace My {
	struct GfxConfiguration {
		/// Inline all-elements constructor.
		/// \param[in] r 红色的位深度
		/// \param[in] g 绿色的位深度
		/// \param[in] b 蓝色的位深度
		/// \param[in] a 透明度的位深度
		/// \param[in] d 深度缓冲区的位深度
		/// \param[in] s 模板缓冲区(stencil buffer)的位深度
		/// \param[in] msaa 多重采样抗锯齿(msaa)的样本数
		/// \param[in] width 屏幕宽度像素值
		/// \param[in] height 屏幕高度像素值
		GfxConfiguration(
			uint32_t r = 8, uint32_t g = 8,
			uint32_t b = 8, uint32_t a = 8,
			uint32_t d = 24, uint32_t s = 0, uint32_t msaa = 0,
			uint32_t width = 1920, uint32_t height = 1080, 
			const wchar_t* app_name=L"GameEngineFromScratch") :
			redBits(r), greenBits(g), blueBits(b), alphaBits(a),
			depthBits(d), stencilBits(s), msaaSamples(msaa),
			screenWidth(width), screenHeight(height), appName(app_name)
		{}

		uint32_t redBits;           // 分别表示红色、绿色、蓝色和透明度通道的位深度
		uint32_t greenBits;         // 分别表示红色、绿色、蓝色和透明度通道的位深度
		uint32_t blueBits;          // 分别表示红色、绿色、蓝色和透明度通道的位深度
		uint32_t alphaBits;         // 分别表示红色、绿色、蓝色和透明度通道的位深度

		uint32_t depthBits;         // 深度缓冲区的位深度
		uint32_t stencilBits;       // 模板缓冲区的位深度

		uint32_t msaaSamples;       // 多重采样抗锯齿的样本数

		uint32_t screenWidth;       // 屏幕的宽度和高度
		uint32_t screenHeight;      // 屏幕的宽度和高度

        const wchar_t* appName;     // 应用程序的名称

        friend std::wostream& operator<<(std::wostream& out, const GfxConfiguration& conf)
        { 
            out << "App Name:" << conf.appName << std::endl;
            out << "GfxConfiguration:" << 
                " R:"  << conf.redBits << 
                " G:"  << conf.greenBits <<
                " B:"  << conf.blueBits <<
                " A:"  << conf.alphaBits <<
                " D:"  << conf.depthBits <<
                " S:"  << conf.stencilBits <<
                " M:"  << conf.msaaSamples <<
                " W:"  << conf.screenWidth <<
                " H:"  << conf.screenHeight <<
                std::endl;
            return out;
        }
	};
}

